<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/taglib/jstl.jsp" %>
<%@ include file="/WEB-INF/taglib/spEl.jsp" %>

<sec:authorize var="isFullyAuthenticated" access="isFullyAuthenticated()" />
<c:choose>
	<c:when test="${isFullyAuthenticated}"><sec:authentication var="menu" property="principal.myMenu"/></c:when>
	<c:otherwise><c:set var="menu" value="${guest.myMenu}" /></c:otherwise>
</c:choose>

<div class="header-menu">
	<div style="float:left;">
		<ul>
			<li class="logo"><img src="/resources/images/common/logo_mini.gif"></li>
			<li class="menu">
				<ul>
					<li class="menu-space"></li>
					<c:choose>
						<c:when test="${not empty menu}">						
							<c:forEach var="items" items="${menu}" varStatus="i">
								<c:set var="class" value="menu-off" />
								<c:if test="${i.count == 1}"><c:set var="class" value="menu-on" /></c:if>
								
								<c:if test="${items.fnParentId == '0'}">
									<li class="${class}">
										${items.fnAlias}
										<span class="noneSpan">${items.fnServletUrl}</span>
										<span class="noneSpan">${items.fnId}</span>
									</li>
									<li class="menu-space"></li>
								</c:if>
							</c:forEach>
						</c:when>
						<c:otherwise></c:otherwise>
					</c:choose>
				</ul>
			</li>
		</ul>
	</div>
	
	<div style="float:right;">
		<ul>
			<li class="opts">
				<ul>
					<c:choose>
						<c:when test="${isFullyAuthenticated}">
							<li class="username">
								<span id=""><sec:authentication property="principal.lastName" htmlEscape="false"/></span>
								(<span id=""><sec:authentication property="principal.username" htmlEscape="false"/></span>) 님
							</li>
							<li><input type="button" name="btnUserRevise" value="정보 수정"/>&nbsp;</li>
							<li class="btns">
								<form name="frmAuth" action="j_spring_security_logout" method="post">
									<input type="submit" name="submit" value="Logout"/>
								</form>
							</li>
						</c:when>
						<c:otherwise>
							<li class="btns"><input type="button" name="" value="Login"/></li>
						</c:otherwise>
					</c:choose>
				</ul>
			</li>
		</ul>
	</div>
	
	<div style="clear:both;"></div>
</div>

<!-- 자바 스크립트 -->
<script type="text/javascript" src="/resources/js/layouts/inc/header.js"></script>